/**
 * 
 */
package com.chen.posp.sodexo;

import java.util.HashMap;
import java.util.Map;

import com.chen.posp.sodexo.client.SimpleClient;
import com.chen.posp.sodexo.factory.XmlReader;
import com.chen.posp.sodexo.model.Constants;



/**
 *
 *@类名称：SXTest.java
 *@类描述：
 *@创建人：zhongy
 *@创建时间：2018年3月23日-下午2:22:55
 *@修改备注:
 *@version 
 */
public class SXTest {
	public static void main(String[] args) throws Exception {
		String configUrl = "sodexo/sodexo.xml";// 配置文件XML的路径
		String tpdu="6000870000";
		String tid="00002395";
		String mid="000000000000057";
		String ip="58.215.166.38";
		String mti="0800";//消息类型
		int port=1005;
		String key="99BFDDF31B204664F099BFDDF31B204664F0";//4462002EC6FD9BB94462002EC6FD9BB9
		Map<String,String> requestMap=new HashMap<String, String>();
		requestMap.put(Constants.MTI, mti);// 设置消息类型
		requestMap.put(Constants.TPDU, tpdu);
		requestMap.put("3", "991380");
		requestMap.put("11", "201803");//消息交易号
//		requestMap.put("12", "144959");//时间
//		requestMap.put("13", "0323");//日期
		requestMap.put("24", "012");
		requestMap.put("41", tid);
		requestMap.put("42", mid);
		requestMap.put("43", "");
		requestMap.put("62", "");//数据域
		 
		
		SimpleClient simpleClient = new SimpleClient(ip, port, 5000);
		simpleClient.setMacKey(key);
		XmlReader xmlReader=null;
		Map<String, String> resultMap = new HashMap<String, String>();
		try {
			// 读取报文配置文件
			xmlReader = new XmlReader(configUrl);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		resultMap = simpleClient.sendToBank(requestMap, xmlReader);
		
	}
	
	
	

}
